UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sh6sBE7TcaOh+RyrgLBBCLIZ9VnaXW2JUO3XGXvCHYQ=' 
WHERE 
  key_id = 'd9c750cd7c0cca272678406a8c53798449bade88c00a8a10d04097b3bad2394a' 
  AND (
    token = 'sh6sBE7TcaOh+RyrgLBBCLIZ9VnaXW2JUO3XGXvCHYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028