UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dnvW/uy8TY/t04xAqAkrugH7UaRFXzYoOTUrvYm34mA=' 
WHERE 
  key_id = 'f4b929a9920187cd8ea01139d5248c63702d2e678c901be9d2001e9d1007a245' 
  AND (
    token = 'dnvW/uy8TY/t04xAqAkrugH7UaRFXzYoOTUrvYm34mA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023