UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rQrMC5ul7kc5SGNypLNOiDp6BVwCGDSccV1FG1oq76M=' 
WHERE 
  key_id = '0964823304572c8ba6dd64745042aa9dda2fccc83b27e549c49f8bba64846107' 
  AND (
    token = 'rQrMC5ul7kc5SGNypLNOiDp6BVwCGDSccV1FG1oq76M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055