UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QPbnziLiqDwht29IU3KQdghS6BA4nX04VlwUhtiK7MU=' 
WHERE 
  key_id = '77e314bb32e6dd24466496edb634290d956f5d767c6cde6847e6bf640fd2e56e' 
  AND (
    token = 'QPbnziLiqDwht29IU3KQdghS6BA4nX04VlwUhtiK7MU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034