UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fQDTXsnqc7u1KsERy35qEgcAQYFK0BXT268mrO9F7PA=' 
WHERE 
  key_id = 'f04bfebf359b8e4a833968c79338bb7c1db99a51edc46ea263d5107818dd4c55' 
  AND (
    token = 'fQDTXsnqc7u1KsERy35qEgcAQYFK0BXT268mrO9F7PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028