UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QcZYTXb1TQHZw7SEgugjDQT5X6AftHRocEM62+ATRfw=' 
WHERE 
  key_id = '16933784c9270fbbdc83bc76635526e95b8b647b5a2274545f2e0ace4aee2184' 
  AND (
    token = 'QcZYTXb1TQHZw7SEgugjDQT5X6AftHRocEM62+ATRfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024