UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ThNFqJ0G5y7Vx5YBVJDvxpVf+ohMIpRRqDxy5jJD4e8=' 
WHERE 
  key_id = 'cec5a27152e4e783fc7f67a9f8b4d7704794b848b14ccac7894c36c41b4776d6' 
  AND (
    token = 'ThNFqJ0G5y7Vx5YBVJDvxpVf+ohMIpRRqDxy5jJD4e8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058