UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HIr5BCB5W6i/YVk+FnU9LyK1oquODbDdxxWzfkUix98=' 
WHERE 
  key_id = '0c0167074390e6dd37cc06b9ac4b5ffd8902d979c5240ab788eddb06329ac179' 
  AND (
    token = 'HIr5BCB5W6i/YVk+FnU9LyK1oquODbDdxxWzfkUix98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027