UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LSF8ey8zLpZuzxrwt6ZoOctGwJ7VaV6vchCuKNQcYus=' 
WHERE 
  key_id = '3030c096e5af6f7e24abf368672989a6c454256ffb885a1f36cfbc388d980a5a' 
  AND (
    token = 'LSF8ey8zLpZuzxrwt6ZoOctGwJ7VaV6vchCuKNQcYus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052