UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GjgyeDsxY+aqyibCzx+JihriTzFXCYI1zYnEBliBF/Q=' 
WHERE 
  key_id = 'dcfe9cbfbe24c4422d69e0aa5b0ccabbd1e29c62b90174ef4a6677a4d9975489' 
  AND (
    token = 'GjgyeDsxY+aqyibCzx+JihriTzFXCYI1zYnEBliBF/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018