UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qsiaaAAkYzAXJccIAZTyeDfTQcOYudsXIUBCxi4KNX0=' 
WHERE 
  key_id = '9152f551bcce1b5b32649203305974635aea7e81c381a4ebb097728fa2c3d2a8' 
  AND (
    token = 'qsiaaAAkYzAXJccIAZTyeDfTQcOYudsXIUBCxi4KNX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044