UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o/af4eNIZbeOtAOtDcdj6442VeEZCuKTsEtV/1jhJjo=' 
WHERE 
  key_id = 'da6d2dddc12d309e83759693e977195b1e41251b5cf37850452562cca21945f0' 
  AND (
    token = 'o/af4eNIZbeOtAOtDcdj6442VeEZCuKTsEtV/1jhJjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018