UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'syHDjK3ExLcK4eh6XnpnRkTNsN8/3oqrdcgJkOm9C7A=' 
WHERE 
  key_id = '51638c4b86f0cde9bdc8de190faaff24c170c4725e8d41a0c329e549bca04971' 
  AND (
    token = 'syHDjK3ExLcK4eh6XnpnRkTNsN8/3oqrdcgJkOm9C7A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031