UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'luN4ZewUlQtr+1ROSLf3Bdw4UPKdf/F96jvOvOqq8qc=' 
WHERE 
  key_id = '08bf288017896c255c2faaa0aea51589c55451a427aa18e584433299712483f7' 
  AND (
    token = 'luN4ZewUlQtr+1ROSLf3Bdw4UPKdf/F96jvOvOqq8qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032