UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TF5o7Jqq7lFEEh79KFnjA/l2g7bha/im5UCg8aRM0Ww=' 
WHERE 
  key_id = '3491df7a663273bef2088e2086964696277cd57c2aa0ec6eb0ff748a9cc15477' 
  AND (
    token = 'TF5o7Jqq7lFEEh79KFnjA/l2g7bha/im5UCg8aRM0Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022