UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vahYom3EJ4qDrAQh3T7vCl+buKmGObaJc57EX48bH+g=' 
WHERE 
  key_id = 'fd9b5b47c325089be2482f43d99dbb4e30ba63d402cc6fadd26e66fae13c1748' 
  AND (
    token = 'vahYom3EJ4qDrAQh3T7vCl+buKmGObaJc57EX48bH+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017