UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQ45yY+P5h6SQplr4f621mtw5IHqq3bstTBksDinRk4=' 
WHERE 
  key_id = '97a60ce9ced586086d02685c44a56355122f482ce42663dbfac5927114f90db4' 
  AND (
    token = 'VQ45yY+P5h6SQplr4f621mtw5IHqq3bstTBksDinRk4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024