UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1VrMsbDMEIQqeWnaxCEU+27WfmxLEVHLlezxUx/nHlA=' 
WHERE 
  key_id = 'aa407c4c4b4124312ac298cb7d661d25a0700ab62237795aff9385cf2365de10' 
  AND (
    token = '1VrMsbDMEIQqeWnaxCEU+27WfmxLEVHLlezxUx/nHlA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033