UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W5RivbnREKVR5MhKggYMOiywTf/irywf4smWekeWG/A=' 
WHERE 
  key_id = '23fea252dec9dc63a77fc97dd16364e34771657a232167886344f49a9d4c9e5d' 
  AND (
    token = 'W5RivbnREKVR5MhKggYMOiywTf/irywf4smWekeWG/A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023