UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'slzlBDoACWvQHm08wIEEtKnopx1O4LjUREgMikibFwM=' 
WHERE 
  key_id = 'dedbe6e1f13723ce12ad51311241947b82b8474a50d19c0f01b21ed46c31b79e' 
  AND (
    token = 'slzlBDoACWvQHm08wIEEtKnopx1O4LjUREgMikibFwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036