UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGwC9F2X829bu+HSczel2vSeomMVdadSX6xXvnyBc4Y=' 
WHERE 
  key_id = '1ca740fbf8f68243ee1c9f17b00e80f2fccc69d213ce1bda761596f05c784efd' 
  AND (
    token = 'DGwC9F2X829bu+HSczel2vSeomMVdadSX6xXvnyBc4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020