UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'edqAxxrH7S+C+fcnHXcIYIyH2V3FT6m/y7u8wwwta+g=' 
WHERE 
  key_id = '995eee6b782a1196892686345473b4df1c0ea2891e6256765bf8a01064b82195' 
  AND (
    token = 'edqAxxrH7S+C+fcnHXcIYIyH2V3FT6m/y7u8wwwta+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033