UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2GPCs+TNqmH86izSX8Vwr6fWhnLO/YNm1R51jaHm4M=' 
WHERE 
  key_id = '9a72918cbd3fc3f866841cbf24f87bbfd2fca5e2f0f1a176ed1de9d51180a0be' 
  AND (
    token = 'N2GPCs+TNqmH86izSX8Vwr6fWhnLO/YNm1R51jaHm4M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040