UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'viv5AN2agPpa0PdVwTc843/V7f10KmVzYiMuOStKeB8=' 
WHERE 
  key_id = '18c52cd2e1db633589b396f821c651c3b5d8e1ac0cf0daffa56a5110f63ae15d' 
  AND (
    token = 'viv5AN2agPpa0PdVwTc843/V7f10KmVzYiMuOStKeB8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044