UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gVvz4qktUDH6CCmMrVPT3NX/PMmXJ9nKc+U3rJzOL+0=' 
WHERE 
  key_id = '1f8af92704a8f759b8f469146f1bd68783fc6ab3a9b33c7790913cd8b25268b8' 
  AND (
    token = 'gVvz4qktUDH6CCmMrVPT3NX/PMmXJ9nKc+U3rJzOL+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017