UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DPGiHCR4uRSntZYwVg3agk1vhUg54+ekADLaYdXyiT8=' 
WHERE 
  key_id = '5adf534c0b711c4a5f46509758f6577eca7773369d4788ede30e863ebb8d9d67' 
  AND (
    token = 'DPGiHCR4uRSntZYwVg3agk1vhUg54+ekADLaYdXyiT8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033