UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AofUpkLdj8G2gqWYhWwP0Qi2j5KTHVRq6ojbigAA2Mc=' 
WHERE 
  key_id = '05685cc4004353a596c31f7022dcc1fa63e23370b5a491b35a42abbede49b34b' 
  AND (
    token = 'AofUpkLdj8G2gqWYhWwP0Qi2j5KTHVRq6ojbigAA2Mc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032