UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9LpRXNT4dnZHbJQXOq40mCsKzFIjFxy+VRCOHFzzRdQ=' 
WHERE 
  key_id = 'ac7ac83e2031531c16f97b4283ac283add3db30ec5592c2bc2b35c87027427c0' 
  AND (
    token = '9LpRXNT4dnZHbJQXOq40mCsKzFIjFxy+VRCOHFzzRdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034