UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'np0mGfA8MtRGN4FtUxxiFwqQZqY2nsloFxHOQVjO/YA=' 
WHERE 
  key_id = 'f1b6a789475dff9b2435582c04346316d8984e8d8a91984069b5fed303536774' 
  AND (
    token = 'np0mGfA8MtRGN4FtUxxiFwqQZqY2nsloFxHOQVjO/YA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029