UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PpR95H0J+sw8T/cs/2KekKkb+tObbXTT+0MltFVRwzw=' 
WHERE 
  key_id = '9906d993ba820e573cac5522907e21fb6057c40b3981ffbdc735d0783c73ee3b' 
  AND (
    token = 'PpR95H0J+sw8T/cs/2KekKkb+tObbXTT+0MltFVRwzw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021