UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pVE7XsT4SnkW8gQBQxxrDygpZRviuVKYO0gCuic8vYc=' 
WHERE 
  key_id = 'b60b10be844226ae92397133a6457acab9f7ce570e992c293eaca87e0c3af9ad' 
  AND (
    token = 'pVE7XsT4SnkW8gQBQxxrDygpZRviuVKYO0gCuic8vYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029