UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A5P+ubORUp3C4oAsPTAkDGlQcTTxc1xIxNCwKJMXLug=' 
WHERE 
  key_id = '06713770251f1e7b1d55bda25d4b8dcea8c53911703f2772479f05ea4a331315' 
  AND (
    token = 'A5P+ubORUp3C4oAsPTAkDGlQcTTxc1xIxNCwKJMXLug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019