UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nzd5ygGi13cdy2G0LAK5tM9tjudKFioy2RylvvmCuMM=' 
WHERE 
  key_id = '1292ebfe15a269806f25148691e3589bae1498206a65f02f590b4d5f49a551a1' 
  AND (
    token = 'nzd5ygGi13cdy2G0LAK5tM9tjudKFioy2RylvvmCuMM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044