UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jt2mgq8vX3MzBoXrWjm4tJV6Hfpw0TwPBEVQfHBebeo=' 
WHERE 
  key_id = '651630a80c2460643d76aed35dcdab268fe8d0f3427032f9357d48085a80878a' 
  AND (
    token = 'Jt2mgq8vX3MzBoXrWjm4tJV6Hfpw0TwPBEVQfHBebeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030