UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ieom1oXuLHiLAx+CvjZb6ePfXdg7ct9AgRQJLoX/4x8=' 
WHERE 
  key_id = '311e979e7a98dade9e657a737fb23498aff5c8a64341f5dc0928359e38baa9d1' 
  AND (
    token = 'ieom1oXuLHiLAx+CvjZb6ePfXdg7ct9AgRQJLoX/4x8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037