UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JoiO0RnUGt3p3vBAXCzsqgzYM2MR9c1zqLR0EDMeqNQ=' 
WHERE 
  key_id = '40e4fb4464e413491ff6b4fdac223cfb09b9a1a0e2fddadb52544fdd1f09f285' 
  AND (
    token = 'JoiO0RnUGt3p3vBAXCzsqgzYM2MR9c1zqLR0EDMeqNQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030