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

Query time 0.00053