UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SB2kEpMi2zUPc419OFSaWUQ4uJ5Y92mLg5+lU7/mzZg=' 
WHERE 
  key_id = 'fabe8daf11e4d49eddc015b7e69915864e5e415fd0f7adff780c395c4ab84e9e' 
  AND (
    token = 'SB2kEpMi2zUPc419OFSaWUQ4uJ5Y92mLg5+lU7/mzZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028