UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bzibz4c7NPp+uHnDSnxC7dO4Pg3jYJO6MY+VZwgI1Xk=' 
WHERE 
  key_id = '5038df89eead665895550f9360f5fbcb23c1e0b6df154dbd89dc2c526c2ad930' 
  AND (
    token = 'bzibz4c7NPp+uHnDSnxC7dO4Pg3jYJO6MY+VZwgI1Xk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030