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

Query time 0.00028