UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KcMx+1q+3pJ27cm/WT7ZuC9YSbQ94jdWv5L/yuXB5rY=' 
WHERE 
  key_id = '4eae7d55fd7a5e5bed09c584ea3040910b970311221182306a08e9f7a3c6a939' 
  AND (
    token = 'KcMx+1q+3pJ27cm/WT7ZuC9YSbQ94jdWv5L/yuXB5rY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024